package com.qf.boot2203.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;


@WebFilter("/*")
@Slf4j
public class HelloFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.debug("filter init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

        log.debug("进入 doFilter");
        filterChain.doFilter(servletRequest,servletResponse); //放行当前请求，交给后续的servlet继续处理
    }

    @Override
    public void destroy() {
        log.debug("filter destory");
    }
}
